<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
	<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
	<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Expires" content="0">
	{include file="Public:header" /}
	<title>门店首页</title>
	<meta name="description" content="">
	<link rel="stylesheet" href="__WECHATCSS__/main.css">
	<script type="text/javascript">
		(function (win, doc) {
			if (!win.addEventListener) return;
			var html = document.documentElement;
			function setFont() {
				var cliWidth = html.clientWidth;
				html.style.fontSize = 100 * (cliWidth / 750) + 'px';
			}
			win.addEventListener('resize', setFont, false);
			setFont();
		})(window, document);
	</script>
</head>

<body>
	<div class="container">
		<div class="head">
			<div class="PersonalImgNav">
				<div class="nav">
					<img src="{$member_info.headimgurl}" />
				</div>
			</div>
			<div class="map-text">
				您所在位置<br />
				<p>{$storeInfo.name}</p>
			</div>
		</div>
		<div class="list">
			<h1>归还列表</h1>
			<table border="1" cellspacing="0" cellpadding="0" bordercolor="#959595">
				{volist name="list" id="v"}
				<tr>
					<td>订单号:</td>
					<td>{$v.order_sn}</td>
				</tr>
				<tr>
					<td>座&nbsp;&nbsp;&nbsp;&nbsp;位:</td>
					<td>{$v.seat_num}</td>
				</tr>
				<tr>
					<td>分&nbsp;&nbsp;&nbsp;&nbsp;类:</td>
					<td>{$v.goods_name}</td>
				</tr>
				<tr>
					<td>金&nbsp;&nbsp;&nbsp;&nbsp;额:</td>
					<td>￥{$v.total_amount}</td>
				</tr>
				<tr>
					<td>操&nbsp;&nbsp;&nbsp;&nbsp;作:</td>
					<td>
						{if condition="$v.hire_status == 2"}
						<button type="button" class="apply_return" data-id="{$v.order_id}">申请归还</button>
						{/if}
						{if condition="$v.hire_status == 3 && ($v.audit_status == 2 || $store_id != $v.return_store_id)"}
						{if condition="$v.audit_status == 2"}
						<button type="button" class="audit_remark" data-remark="{$v.audit_remark}">拒绝原因</button>
						{/if}
						{if condition="$v.audit_status == 2 || $store_id != $v.return_store_id"}
						<button type="button" class="apply_return" data-id="{$v.order_id}">重新申请</button>
						{/if}
						{/if}
					</td>
				</tr>
				{/volist}
			</table>
			<div style="text-align: center;">
				{$page}
			</div>
			<input type="hidden" name="store_id" value="{$storeInfo.id}">
			<input type="hidden" name="store_id" value="{$storeInfo.id}">
		</div>
		<!-- 页脚和弹框 -->
		<div class="footer"></div>
		<div class="alert" style="display: none;">
			<div class="alert-text">
				<h3>提示</h3>
				<span class="alert_content">提示信息</span>
				<p id="display">OK</p>
			</div>
		</div>	
	</div>
	<script src="__WECHATASSETS__/jquery.min.js"></script>
	<script src="__WECHATASSETS__/zepto.min.js"></script>
	<script src="__WECHATJS__/main.js"></script>
	{include file="Public:footer" /}

	<script type="text/javascript">
		$(function () {
			$('.apply_return').click(function () {
				var order_id = $(this).attr('data-id');
				$.ajax({
					url: "{:Url('Order/apply_return')}",
					data: { order_id: order_id, store_id: '{$store_id}', seat_num: '{$seat_num}' },
					type: "post",
					dataType: "json",
					success: function (res) {
						// 弹框
						if($('.alert').css('display')=='none'){
		                    $('.alert').css('display','block');
		                    $('.alert_content').empty().append(res.msg);
							closeAlert(function(){
								window.location = "{:Url('index/hire',['store_id'=>$store_id])}";
							});
	                    };
					}
				});
			});
			$('.audit_remark').click(function () {
				var remark = $(this).attr('data-remark');
				// 弹框
				if($('.alert').css('display')=='none'){
		            $('.alert').css('display','block');
		            $('.alert_content').empty().append(remark);
	            }
	            // alert(remark);
			});
			closeAlert();
		});
	</script>
</body>

</html>